home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / mac / Chapter Tutorials / CaseStudies / ch10.macromedia / spot.dcr / 00002_Slot Parent Script.ls < prev    next >
Encoding:
Text File  |  1996-11-11  |  2.5 KB  |  102 lines

  1. property pMyListPosition, pMySprite, pSpinning, pMyTimeOut
  2. global cSlotOffset, gStartTime, gCounter, cBlurCastOffset, cBlurCastOffset2, gPicOffset, gSlotsList
  3.  
  4. on birth me, listPosition
  5.   set pMyListPosition to listPosition
  6.   set pMySprite to pMyListPosition + cSlotOffset
  7.   set pSpinning to 1
  8.   set pMyTimeOut to getAt(gSlotsList, pMyListPosition) * 30
  9.   return me
  10. end
  11.  
  12. on slotChanger me
  13.   checkTime()
  14.   if pSpinning then
  15.     if the castNum of sprite pMySprite = (cBlurCastOffset + 4) then
  16.       set the castNum of sprite pMySprite to cBlurCastOffset + 1
  17.     else
  18.       set the castNum of sprite pMySprite to the castNum of sprite pMySprite + 1
  19.     end if
  20.   end if
  21.   if gCounter = 4 then
  22.     go("burning")
  23.   end if
  24.   updateStage()
  25. end
  26.  
  27. on checkTime me
  28.   if pSpinning then
  29.     set timeCheck to the ticks - gStartTime
  30.     if timeCheck > pMyTimeOut then
  31.       puppetSound("whooshClunk")
  32.       set the castNum of sprite pMySprite to pMyListPosition + gPicOffset
  33.       set gCounter to gCounter + 1
  34.       set pSpinning to 0
  35.     end if
  36.   end if
  37. end
  38.  
  39. on reset me
  40.   set pSpinning to 1
  41.   set pMyTimeOut to getAt(gSlotsList, pMyListPosition) * 30
  42. end
  43.  
  44. on playSlotGame me
  45.   checkSlotTime()
  46.   if pSpinning then
  47.     if the castNum of sprite pMySprite = (cBlurCastOffset2 + 4) then
  48.       set the castNum of sprite pMySprite to cBlurCastOffset2 + 1
  49.     else
  50.       set the castNum of sprite pMySprite to the castNum of sprite pMySprite + 1
  51.     end if
  52.   end if
  53.   if gCounter = 4 then
  54.     go("burning")
  55.   end if
  56.   updateStage()
  57. end
  58.  
  59. on checkSlotTime me
  60.   if pSpinning then
  61.     set timeCheck to the ticks - gStartTime
  62.     if timeCheck > pMyTimeOut then
  63.       puppetSound("whooshClunk")
  64.       set the castNum of sprite pMySprite to random(4) + gPicOffset
  65.       set gCounter to gCounter + 1
  66.       set pSpinning to 0
  67.     end if
  68.   end if
  69. end
  70.  
  71. on resetForSlots me
  72.   set pSpinning to 1
  73.   set pMyTimeOut to pMyListPosition * 30
  74. end
  75.  
  76. on thisIsYourSite me
  77.   checkSiteTime()
  78.   if pSpinning then
  79.     if the castNum of sprite pMySprite = (cBlurCastOffset2 + 4) then
  80.       set the castNum of sprite pMySprite to cBlurCastOffset2 + 1
  81.     else
  82.       set the castNum of sprite pMySprite to the castNum of sprite pMySprite + 1
  83.     end if
  84.   end if
  85.   if gCounter = 4 then
  86.     go("burning")
  87.   end if
  88.   updateStage()
  89. end
  90.  
  91. on checkSiteTime me
  92.   if pSpinning then
  93.     set timeCheck to the ticks - gStartTime
  94.     if timeCheck > pMyTimeOut then
  95.       puppetSound("whooshClunk")
  96.       set the castNum of sprite pMySprite to pMyListPosition + gPicOffset
  97.       set gCounter to gCounter + 1
  98.       set pSpinning to 0
  99.     end if
  100.   end if
  101. end
  102.